Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make event dispatch synchronous #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pavelhoral
Copy link
Member

Change event dispatch process from calling event handlers in an async (setTimeout) fashion to sync calls. This fixes potential race conditions when a specific order of event processing is expected (e.g. showing and hiding loading progress spinner).

Why I see this as a meaningful change? The decision to process any event in async fashion shuold be done by the event subscriber, not the event dispatcher / manager. Or potentially the triggering component might want to send event asynchronously... again, that decision should not be made by the dispatcher / manager.

Change event dispatch process from calling event handlers in an
async (setTimeout) fashion to sync calls. This fixes potential
race conditions when a specific order of event processing is
expected (e.g. showing and hiding loading progress spinner).
@pavelhoral
Copy link
Member Author

This needs to have proper error handling (at least by ignoring or simply logging errors).

Also we might want to support both sync and async EventManagers (e.g. like EventEmitter from Angular. So that in case this breaks something in our project we might have opt-out of the sync behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant